﻿@using com.hyrentals.webcommon.extensions
@using com.hyrentals.webportal.Config
@using com.hyrentals.data

@model com.hyrentals.data.RV
@{
    Html.AddStyle("css/rv");
    Html.AddTailScript("js/rv-automotive");

    string calendarUrl = string.Format("/rv/{0}/edit/calendar", Model.Id);
    string pricingUrl = string.Format("/rv/{0}/edit/pricing", Model.Id);
    string overviewUrl = string.Format("/rv/{0}/edit/overview", Model.Id);
    string automotiveUrl = string.Format("/rv/{0}/edit/automotive", Model.Id);
    string interiorUrl = string.Format("/rv/{0}/edit/interior", Model.Id);
    string photosUrl = string.Format("/rv/{0}/edit/photos", Model.Id);
    string addressUrl = string.Format("/rv/{0}/edit/address", Model.Id);
}

<div class="layout-primary">
    <div class="layout-primary-left">
        <ul class="manage-rv-nav">
            <li><a href="@calendarUrl">Calendar</a></li>
            <li><a href="@pricingUrl">Pricing</a></li>
            <li><a href="@overviewUrl">Overview</a></li>
            <li><a class="active" href="@automotiveUrl">RV Details</a></li>
            <li><a href="@photosUrl">Photos</a></li>
            <li><a href="@addressUrl">Address</a></li>
        </ul>
    </div>
    <div class="layout-primary-middle">
        <ul class="rv-detail-nav clearfix">
            <li><a class="active" href="@automotiveUrl">Automotive</a></li>
            <li><a href="@interiorUrl">Interior</a></li>
        </ul>
        <form id="J_Automotive" class="form-s2 form-rv-details" action="" method="post">
            <div class="valid-simple">
                <input type="hidden" value="@Model.Id" name="id"/>
                <div class="section chk-group clearfix">
                @{
                    foreach (RVAutomotiveBasicFeatureEnum basicFeature in Enum.GetValues(typeof(RVAutomotiveBasicFeatureEnum)))
                    {
                        byte index = (byte)basicFeature;
                        string name = NameMapping.RVAutomotiveBasicFeatureEnumNameArray[index];
                        string id = string.Format("basic_{0}", index);
                        bool isChecked = Model.ContainAutomotiveBasicFeature(basicFeature);
                        <label for="@id" class="">
                        @{
                            if (isChecked)
                            {
                                <input type="checkbox" value="@index" id="@id" name="basicFeatures" checked="checked"/>
                            }
                            else
                            {
                                <input type="checkbox" value="@index" id="@id" name="basicFeatures"/>
                            }
                        }
                            <span>@name</span>    
                        </label>
                    }
                }
                </div>
                <div class="section">
                    <h2>Overdrive Transmission</h2>
                    <hr />
                    <div class="radio-group clearfix">
                    @{
                        foreach (RVOverdriveTransmissionEnum overdriveTrans in Enum.GetValues(typeof(RVOverdriveTransmissionEnum)))
                        {
                            byte index = (byte)overdriveTrans;
                            string name = NameMapping.RVOverdriveTransmissionEnumNameArray[index];
                            string id = string.Format("trans_{0}", index);
                            bool isChecked = Model.ContainOverdriveTransmission(overdriveTrans);
                            <label for="@id" class="">
                             @{
                                if (isChecked)
                                {
                                    <input type="radio" value="@index" id="@id" name="overdriveTrans" checked="checked"/>
                                }
                                else
                                {
                                    <input type="radio" value="@index" id="@id" name="overdriveTrans"/>
                                }
                            }
                                <span>@name</span>
                            </label>
                        }
                    }
                    </div>
                </div>
                <div class="section chk-group">
                    <h2>Electrical</h2>
                    <hr />
                    <div class="clearfix">
                @{
                    foreach (RVAutomotiveElectricalFeatureEnum electricalFeature in Enum.GetValues(typeof(RVAutomotiveElectricalFeatureEnum)))
                    {
                        byte index = (byte)electricalFeature;
                        string name = NameMapping.RVAutomotiveElectricalFeatureEnumNameArray[index];
                        string id = string.Format("electrical_{0}", index);
                        bool isChecked = Model.ContainElectricalFeature(electricalFeature);
                        <label for="@id" class="">
                        @{
                            if (isChecked)
                            {
                                <input type="checkbox" value="@index" id="@id" name="electricalFeatures" checked="checked"/>
                            }
                            else
                            {
                                <input type="checkbox" value="@index" id="@id" name="electricalFeatures"/>
                            }
                        }
                            <span>@name</span>
                        </label>
                    }
                }
                </div>
                </div>
                <div class="section">
                    <h2>Engine</h2>
                    <hr />
                    <div class="radio-text clearfix">
                    <div class="left">
                     @{
                         foreach (RVAutomotiveEngineTypeEnum engineType in Enum.GetValues(typeof(RVAutomotiveEngineTypeEnum)))
                         {
                             byte index = (byte)engineType;
                             string name = NameMapping.RVAutomotiveEngineTypeEnumNameArray[index];
                             string id = string.Format("engine_{0}", index);
                             bool isChecked = Model.ContainEngineType(engineType);
                            <label for="@id" class="">
                            @{
                                if (isChecked)
                                {
                                    <input type="radio" value="@index" id="@id" name="engineType" checked="checked"/>
                                }
                                else
                                {
                                    <input type="radio" value="@index" id="@id" name="engineType"/>
                                }
                            }
                                <span>@name</span>
                            </label>
                        }
                    }
                    </div>
                    <div class="right">
                        <input id="fuel_consumption" class="input-text" type="text" name="fuelConsumption" value="@Model.FuelConsumption" data-msgbox="#msg_fuel_consumption"/>
                        <span id="msg_fuel_consumption" style="display: none;"></span>
                    </div>
                    </div>
                </div>
                <div class="section">
                    <h2>Others</h2>
                    <hr />
                    <div class="row clearfix">
                        <label for="chassis" class="label">Chassis</label>
                        <input id="chassis" class="input-text" type="text" name="chassis" value="@Model.Chassis" data-msgbox="#msg_chassis"/>
                        <span id="msg_chassis" style="display: none;"></span>
                    </div>
                    <div class="row clearfix">
                        <label for="gross_weight" class="label">Gross Weight</label>
                        <input id="gross_weight" class="input-text" type="text" name="grossWeight" value="@Model.GrossWeight" data-msgbox="#msg_gross_weight"/>
                        <span id="msg_gross_weight" style="display: none;"></span>
                    </div>
                    <div class="row clearfix">
                        <label for="tongue_weight" class="label">Tongue Weight</label>
                        <input id="tongue_weight" class="input-text" type="text" name="tongueWeight" value="@Model.TongueWeight" data-msgbox="#msg_tongue_weight"/>
                        <span id="msg_tongue_weight" style="display: none;"></span>
                    </div>
                </div>
                <div class="section clearfix">
                    <a id="J_Sumbit" href="javascript:;" class="btn btn-large submit">Save</a>
                </div>
            </div>
        </form>
    </div>
    <div class="layout-primary-right"></div>
</div>